package own.redis;

import java.lang.reflect.Field;
import java.util.List;

import own.bean.User;
import own.utils.SpringUtils;

public class JEdisTest {

	public static void main(String[] args) throws Exception {
		 IJEdisDB<User>
		 db=(IJEdisDB<User>)SpringUtils.getBean("javaEdisDBImpl");
		 System.out.println(db);
		 List<User> users=db.getList("list1", User.class);
		 for(User u:users){
		 System.out.println(u.toString());
		 }
		 IJEdisDB<User>
		 db2=(IJEdisDB<User>)SpringUtils.getBean("springRedisDBImpl");
		 System.out.println(db2);
		 users=db2.getList("list1", User.class);
		 for(User u:users){
		 System.out.println(u.toString());
		 }
		 System.out.println(SpringUtils.getBean("jacksonJsonRedisSeriaziler"));

		User user=new User();
		Field[] fs = user.getClass().getDeclaredFields();

		for (Field f : fs) {
			f.setAccessible(true);
			if(f.getType() ==Integer.class )
				f.set(user, 1);
			if(f.getType() ==String.class )
				f.set(user, "Jack");
		}
		System.out.println(user.toString());
	}
}
